﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 判断线段相交
{
    /// <summary>
    /// 线段
    /// </summary>
    class Line
    {
        public Point FromPoint;
        public Point ToPoint;
        public Envelope Envelope;
        public Line(Point from, Point to)
        {
            FromPoint = from;
            ToPoint = to;
            double xmin, xmax, ymin, ymax;
            xmin = FromPoint.X <= ToPoint.X ? FromPoint.X : ToPoint.X;
            xmax = FromPoint.X >= ToPoint.X ? FromPoint.X : ToPoint.X;
            ymin = FromPoint.Y <= ToPoint.Y ? FromPoint.Y : ToPoint.Y;
            ymax = FromPoint.Y >= ToPoint.Y ? FromPoint.Y : ToPoint.Y;
            Envelope = new Envelope(xmin, xmax, ymin, ymax);
        }
    }
}
